#include "TcpServer.hpp"
#include "Command.hpp"

void TestHandler()
{
    LOG(LogLevel::INFO) << "TestHandler()";
}

// ./tcpserver port
int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        LOG(LogLevel::FATAL) << "Usage error" << argv[0] << " port";
        exit(USAGE_ERR);
    }
    uint16_t port = std::stoi(argv[1]);

    Command command;

    TcpServer tcpserver(port, [&command](const std::string &cmd)
                        { return command.Excute(cmd); });
    tcpserver.Init();
    tcpserver.Run();

    return 0;
}